package vip.xiaonuo.hontu.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Configuration
@Slf4j
@Component
public class FileServerConfig implements ApplicationRunner {

        @Autowired
        private Environment environment;

        public static String serverAddress;

        public static String serverPort;

        public static String serverUrl;


        @Override
        public void run(ApplicationArguments args){
            serverAddress=environment.getProperty("file.server.address");
            serverPort=environment.getProperty("file.server.port");
            serverUrl=environment.getProperty("file.server.url");
        }

        public static String getServerUrl(){
            return serverAddress + ":" +serverPort + serverUrl;
        }

}
